<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use EasyWeChat\Factory;
use EasyWeChat\MiniProgram\Application as MiniProgramApplication;
use EasyWeChat\OfficialAccount\Application as OfficialAccountApplication;

class WechatServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton(MiniProgramApplication::class, function ($app) {
            return Factory::miniProgram(config('wechat'));
        });

        $this->app->singleton(OfficialAccountApplication::class, function ($app) {
            return Factory::officialAccount(config('wechat'));
        });
    }
}
